function Vector (x, y, z) {
  this.x = x
  this.y = y
  this.z = z
}

Vector.prototype = {
  rotateX () {
    let t = this.y
    this.y = -this.z
    this.z = t
  },
  rotateY () {
    let t = this.z
    this.z = -this.x
    this.x = t
  },
  rotateZ () {
    let t = this.x
    this.x = -this.y
    this.y = t
  },
  equals (o) {
    return o.x === this.x && o.y === this.y && o.z === this.z
  },
  getDirection(color){
    if (Math.abs(this.x) === color) return Dimension.x
    if (Math.abs(this.y) === color) return Dimension.y
    if (Math.abs(this.z) === color) return Dimension.z
    return null
  }
}

const Color = {
  blue: 1,
  green: 2,
  orange: 3,
  red: 4,
  yellow: 5,
  white: 6,
  none: 0
}

const Dimension = {
  x: 1,
  y: 2,
  z: 3
}

const ColorValue = [
  'black',
  'blue',
  'green',
  'orange',
  'red',
  'yellow',
  'white'
]

const patternVector = {
  'U'   : ['z', 1, 3],
  'U`' : ['z', 1, 1],
  'D'   : ['z', -1, 1],
  'D`' : ['z', -1, 3],
  'L'   : ['y', -1, 1],
  'L`' : ['y', -1, 3],
  'R'   : ['y', 1, 3],
  'R`' : ['y', 1, 1],
  'F'   : ['x', 1, 3],
  'F`' : ['x', 1, 1],
  'B'   : ['x', -1, 1],
  'B`' : ['x', -1, 3],
}